import React, { Component } from 'react';
import { render } from 'react-dom';
import { bindActionCreators } from 'redux';
import { connect } from 'react-redux';
import Counter from '../components/counter';
import * as CounterActions from '../actions/counter';

class CounterRoute extends Component {
    constructor(props) {
        super(props);
    }

    render() {
        let {counteracts, counter} = this.props;
        return (
            <Counter {...counteracts} counter={counter.counter}/>
        );
    }
}

function mapStateToProps(state) {
    return {
        counter: state.counter
    }
}

function mapDispatchToProps(dispatch) {
    return  {
        counteracts: bindActionCreators(CounterActions, dispatch)
    }
}

export default connect(mapStateToProps, mapDispatchToProps)(CounterRoute);
